package com.school.filesearch110;

import android.annotation.TargetApi;
import android.content.Intent;
import android.os.Build;
import android.os.Handler;
import android.support.v7.app.AppCompatActivity;
import android.os.Bundle;
import android.view.View;
import android.view.WindowManager;

public class LoadingAcivity extends AppCompatActivity {

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        hideBar();
        setContentView(R.layout.activity_loading_acivity);
        Handler x=new Handler();
        x.postDelayed(new splashhandler(),2000);
    }
    private class splashhandler implements Runnable
    {
        public void run()
        {
            startActivity(new Intent(getApplication(),MainActivity.class));
            LoadingAcivity.this.finish();
        }
    }
    @TargetApi(26)
    private void hideBar()
    {
        if(Build.VERSION.SDK_INT>=16)
        {
            View dercoView=getWindow().getDecorView();
            int barOption=View.SYSTEM_UI_FLAG_FULLSCREEN
                    | View.SYSTEM_UI_FLAG_HIDE_NAVIGATION;
            dercoView.setSystemUiVisibility(barOption);
        }
        else
        {
            getWindow().setFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN,
                    WindowManager.LayoutParams.FLAG_FULLSCREEN);
            View dercoView=getWindow().getDecorView();
            int barOption=View.SYSTEM_UI_FLAG_HIDE_NAVIGATION;
            dercoView.setSystemUiVisibility(barOption);
        }
    }
}
